package bridge;

interface P{
    void say();
}

/**
 * 实际的礼物
 */
abstract class GiftImp implements P{ }

/**
 * 抽象的礼物
 */
abstract class Gift implements P{ GiftImp giftImp;}

/**
 * 实际礼物发展的曲线
 */
class Warm extends Gift{
    public Warm(GiftImp giftImp){
        this.giftImp = giftImp;
    }
    public void say(){
        System.out.println("温暖的");
        giftImp.say();
    }
}
class Grim extends Gift{
    public Grim(GiftImp giftImp){
        this.giftImp = giftImp;
    }
    public void say(){
        System.out.println("冷酷的");
        giftImp.say();
    }
}

/**
 * 实际的发展曲线
 */
class Book extends GiftImp{
    public void say(){
        System.out.println("book");
    }
}

class Car extends GiftImp{
    public void say(){
        System.out.println("car");
    }
}

public class Bridge {
    public static void main(String[] args) {
        System.out.println("bridge  ");

        Gift gift = new Warm(new Book());
        gift.say();

    }
}
